package com.seari.kafka;

import java.util.Optional;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

@Component
public class KafkaReceiver
{
	protected static Logger logger = LoggerFactory.getLogger(KafkaReceiver.class);
//	@KafkaListener(topics = {"test","test2","planTest","employeeinfo_change"})
	public void onMessage(ConsumerRecord<?, ?> record)
	{
		Optional<?> kafkaMessage = Optional.ofNullable(record.value());
        if (kafkaMessage.isPresent()) {

            Object message = kafkaMessage.get();

            logger.info("----------------- record =" + record);
            logger.info("------------------ message =" + message);
        }
	}
}
